home *** CD-ROM | disk | FTP | other *** search
/ Champak 103 / Vol 103.iso / games / starship.swf / scripts / DefineSprite_7 / frame_1 / DoAction.as
Text File  |  2010-03-13  |  2KB  |  60 lines

  1. function initSession()
  2. {
  3.    charTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
  4.    charTableCrypt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
  5.    keystring = "whytheheckdoyouwasteyourtimehackingthishighscorelist";
  6.    session = "";
  7.    while(session.length < 20)
  8.    {
  9.       session += charTable.charAt(Math.round(Math.random() * (charTable.length - 1)));
  10.    }
  11. }
  12. function submit(pGame, pDisciple, pScore0, pScore1)
  13. {
  14.    urlSubmit = "http://www.neodelight.com/v4/high_enter.php";
  15.    s = "g=" + pGame + "&";
  16.    s += "d=" + pDisciple + "&";
  17.    s += "s0=" + pScore0 + "&";
  18.    s += "s1=" + pScore1 + "&";
  19.    s += "se=" + escape(session);
  20.    s += "&c=42";
  21.    urlSubmit += "?s=" + escape(encrypt(encrypt(s,keystring),"AnotherKey4You2FindOut4815jiagIOm30JK"));
  22.    getURL(urlSubmit,"_blank");
  23. }
  24. function encrypt(pString, pKey)
  25. {
  26.    text = pString;
  27.    crypt = "";
  28.    checkSum = 0;
  29.    i = 0;
  30.    while(i < text.length)
  31.    {
  32.       char = tableIndex(text.charCodeAt(i),charTable);
  33.       shift = tableIndex(pKey.charCodeAt(i % pKey.length),charTable);
  34.       code = char + shift + checkSum;
  35.       code %= charTable.length;
  36.       crypt += charTableCrypt.charAt(code);
  37.       checkSum += code;
  38.       i++;
  39.    }
  40.    checkSum %= charTable.length;
  41.    return crypt + "" + charTableCrypt.charAt(checkSum);
  42. }
  43. function tableIndex(pCharCode, pTable)
  44. {
  45.    j = 0;
  46.    while(j < pTable.length)
  47.    {
  48.       if(pCharCode == pTable.charCodeAt(j))
  49.       {
  50.          return j;
  51.       }
  52.       j++;
  53.    }
  54. }
  55. _name = "highscores";
  56. charTable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
  57. charTableCrypt = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&=.";
  58. keystring = "whytheheckdoyouwasteyourtimehackingthishighscorelist";
  59. initSession();
  60.